package com.mmall.concurrency;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.web.filter.ForwardedHeaderFilter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@SpringBootApplication
public class ConcurrencyApplications  extends WebMvcConfigurerAdapter {

	public static void main(String[] args) {
		SpringApplication.run(ConcurrencyApplications.class, args);
	}

	@Bean
	public FilterRegistrationBean httpFilter(){
	    
        FilterRegistrationBean  rgistrationBean = new FilterRegistrationBean();
        rgistrationBean.setFilter(new HttpFilters());
        rgistrationBean.addUrlPatterns("/threadLocal/*");
        return  rgistrationBean;
        
    }
    
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new HttpInterceptors()).addPathPatterns("/**");
    }
    
	
}
